<!DOCTYPE html>
<html>
  <head>
    <meta charset="UTF-8">
    <title>留存统计</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <link rel="shortcut icon" href="/favicon.ico" type="image/x-icon" />
    <link rel="stylesheet" href="{$Think.const.RESOURCE}css/font.css">
    <link href="{$Think.const.RESOURCE}css/bootstrap.min.css?v=3.3.6" rel="stylesheet">
    <link rel="stylesheet" href="{$Think.const.RESOURCE}css/xadmin.css">
    <script type="text/javascript" src="{$Think.const.RESOURCE}js/jquery.min.js"></script>
    <script type="text/javascript" src="{$Think.const.RESOURCE}lib/layui/layui.js" charset="utf-8"></script>
    <script type="text/javascript" src="{$Think.const.RESOURCE}js/xadmin.js"></script>
    <script type="text/javascript" src="{$Think.const.RESOURCE}js/bootstrap-paginator.js"></script>
  </head>
  
  <body class="layui-anim layui-anim-fadein">
    <div class="x-nav">
      <span class="layui-breadcrumb">
        <a href="">首页/留存统计</a>
      </span>
      <a class="layui-btn layui-btn-small" style="line-height:1.6em;margin-top:3px;float:right" href="javascript:location.replace(location.href);" title="刷新">
        <i class="layui-icon" style="line-height:39px">ဂ</i></a>
    </div>
    <div class="x-body">
      <div class="layui-row">
        <form class="layui-form layui-col-md12 x-so" action="{:U('stats/keep')}" method="get">
          <input class="layui-input" placeholder="开始日" name="start_time" id="start"   value ="{$condi.start_time}" >
          <input class="layui-input" placeholder="截止日" name="end_time" id="end"  value="{$condi.end_time}">
          <button class="layui-btn"  lay-submit="" lay-filter="sreach"><i class="layui-icon">&#xe615;</i></button>
        </form>
      </div>

      <xblock>
        <span class="x-right" style="line-height:10px;font-size:15px;float:left;">共有数据:{$count}条</span>
      </xblock>
      <table class="layui-table">
                <thead>
                    <tr>
                        <input type="hidden" id="stimes" value="{$times}">
                        <th ><span style="display: inline-block; min-width: 60px;">日期</span></th>
                        <th>登录用户数</th>
                        <th>新增用户数</th>
                        <th style="color: #88473e;">次日留存</th>
                        <th style="color: #88473e;">三日留存</th>
                        <th style="color: #88473e;">四日留存</th>
                        <th style="color: #88473e;">五日留存</th>
                        <th style="color: #88473e;">六日留存</th>
                        <th style="color: #88473e;">七日留存</th>
                    </tr>
                    </thead>

                    <tbody>
                    <volist name="lists" id="vo">
                        <tr>
                            <th id="time_{$vo.timea}"><span style="display: inline-block; min-width: 60px;">{$vo.timea}</span></th>
                            <th>{$vo.login_peo}</th>
                            <th id="reg_count_{$vo.timea}">{$vo.reg_count}</th>
                            <th style="color: #88473e;" id="d1_{$vo.timea}">{$vo.d1}</th>
                            <th style="color: #88473e;" id="d2_{$vo.timea}">{$vo.d2}</th>
                            <th style="color: #88473e;" id="d3_{$vo.timea}">{$vo.d3}</th>
                            <th style="color: #88473e;" id="d4_{$vo.timea}">{$vo.d4}</th>
                            <th style="color: #88473e;" id="d5_{$vo.timea}">{$vo.d5}</th>
                            <th style="color: #88473e;" id="d6_{$vo.timea}">{$vo.d6}</th>
                        </tr>
                    </volist >
                </tbody>
      </table>
      <div class="page">
            <ul id="example"></ul> 
            <input type="hidden" id="currentPage" value="{$p}">
            <input type="hidden" id="totalPages" value="{$totalPages}">
      </div>
    </div>
    <script>
        layui.use('laydate', function(){
            var laydate = layui.laydate;
            //执行一个laydate实例
            laydate.render({
              elem: '#start' //指定元素
            });

            //执行一个laydate实例
            laydate.render({
              elem: '#end' //指定元素
            });
        });

        $(function () {
            var  currentPage= $("#currentPage").val();   
            var  totalPages= $("#totalPages").val();   
            var options = {
                    bootstrapMajorVersion:3, //对应的bootstrap版本
                    currentPage: currentPage, //当前页数，这里是用的EL表达式，获取从后台传过来的值
                    numberOfPages: 10, //每页页数
                    totalPages:totalPages, //总页数，这里是用的EL表达式，获取从后台传过来的值
                    shouldShowPage:true,//是否显示该按钮
                    itemTexts:function (type, page, current){     
                        switch (type) {
                            case "first":
                                return "首页";
                            case "prev":
                                return "上一页";
                            case "next":
                                return "下一页";
                            case "last":
                                return "末页";
                            case "page":
                                return page;
                        }
                    }, 
                    //点击事件
                    onPageClicked: function (event, originalEvent, type, page) {
                        var url='/stats/keep.html'; 
                        var str = url+'?p='+page+'&'+ $( "form" ).serialize();
                        window.location.href = str;
                    }
            };
            $('#example').bootstrapPaginator(options);
            // var stimes= $("#stimes").val();
            // var stimes= stimes.split(",");
            // Loop_ajax(0,stimes);
        });

        // function Loop_ajax(index, array) {
        //     if (index < array.length) { 
        //         var value = array[index];
        //         $.get("/stats/regpoe", {atime:value},function (data) {
        //                 // $("#reg_count_"+data['timeas']+"").text(data['reg_count']);
        //                 // $("#d1_"+data['timeas']+"").text(data['days']['d1']);
        //                 // $("#d2_"+data['timeas']+"").text(data['days']['d2']);
        //                 // $("#d3_"+data['timeas']+"").text(data['days']['d3']);
        //                 // $("#d4_"+data['timeas']+"").text(data['days']['d4']);
        //                 // $("#d5_"+data['timeas']+"").text(data['days']['d5']);
        //                 // $("#d6_"+data['timeas']+"").text(data['days']['d6']);
        //                 if (index < array.length) {
        //                     Loop_ajax(index + 1, array); 
        //                 }
        //         });
        //     }
        // }
      
        
    </script>
  </body>
</html>